package com.weilive.core.netty;

import org.jboss.netty.channel.Channel;

import com.weilive.core.event.Event;

public class NettyEvents {
	
	public static class Open extends Event {
		public final Channel channel;
		public Open(Channel channel) { this.channel = channel; }
	}
	
	public static class Close extends Event {
		public final Channel channel;
		public Close(Channel channel) { this.channel = channel; }
	}
	
	public static class OnMessage extends Event {
		public final long process_time;
		public final Channel channel;
		public final Object message;
		public OnMessage(long process_time, Channel channel, Object message) { 
			this.process_time = process_time;
			this.channel = channel;
			this.message = message; 
		}
	}
	
	public static class OnError extends Event {
		public final Channel channel;
		public final Throwable cause;
		public OnError(Channel channel, Throwable cause) { this.channel = channel; this.cause = cause;}
	}
	
	public static class WebSocketHandshake extends Event {
		public final Channel channel;
		public WebSocketHandshake(Channel channel) { this.channel = channel; }
	}
}
